package com.esreport.entity;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.GeoPointField;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;

import java.util.Date;

/**
 * App上报数据模型
 */
@Document(indexName = "esreport2",type = "report2")
@Data
public class Report {

    @Id
    private String id;

    /**
     * 动作
     */
    @Field(type = FieldType.Keyword)
    private String action;

    /**
     * app 版本
     */
    @Field(type = FieldType.Keyword)
    private String appVersion;

    /**
     * 手机唯一标识
     */
    @Field(type = FieldType.Keyword)
    private String deviceId;

    /**
     * 分享的标题
     */
    @Field(type= FieldType.Text,analyzer = "ik_smart",searchAnalyzer = "ik_smart")
    private String title;

    /**
     * 分享的类型
     */
    @Field(type=FieldType.Integer)
    private Integer type;

    /**
     * 分享内容id
     */
    @Field(type=FieldType.Long)
    private Long proId;

    /**
     * 持续时间
     */
    @Field(type=FieldType.Integer)
    private Integer duration;

    /**
     * 是否为第一次,0 不是 1 是
     */
    @Field(type=FieldType.Integer)
    private Integer isFirst;

    /**
     * 网络状态
     */
    @Field(type = FieldType.Keyword)
    private String netWorkState;

    /**
     * 手机厂商
     */
    @Field(type = FieldType.Keyword)
    private String phoneBrand;

    /**
     * 手机类型
     */
    @Field(type = FieldType.Keyword)
    private String phoneType;

    /**
     * 站点id
     */
    @Field(type=FieldType.Integer)
    private Integer siteId;

    /**
     * 行为开始时间
     */
    @Field(type = FieldType.Date)
    private Date startTime;

    /**
     * 行为结束时间
     */
    @Field(type = FieldType.Date)
    private Date endTime;

    /**
     * 系统版本
     */
    @Field(type = FieldType.Keyword)
    private String systemVersion;

    /**
     * 用户电话
     */
    @Field(type = FieldType.Keyword)
    private String userName;

    /**
     * 用户地址
     */
    @Field(type= FieldType.Text,analyzer = "ik_smart",searchAnalyzer = "ik_smart")
    private String address;

    /**
     * 当前场景
     */
    @Field(type = FieldType.Keyword)
    private String nowScene;

    /**
     * 跳转场景
     */
    @Field(type = FieldType.Keyword)
    private String toScene;

    /**
     * 来自场景
     */
    @Field(type=FieldType.Keyword)
    private String fromScene;


    /**
     * ip地址
     */
    @Field(type=FieldType.Ip)
    private String ip;


    @GeoPointField
    private GeoPoint location;
    /**
     * 行为标记
     */
    @Field(type=FieldType.Keyword)
    private String seriesSign;

    @Field(type=FieldType.Integer)
    private Integer shopId;
    
    @Field(type=FieldType.Integer)
    private Integer advertiseSpaceId;

    @Field(type=FieldType.Integer)
    private Integer advertisePutId;
}
